package errors

type ErrCode int

const (
	RequestParamsBindCode         int = 10000
	RequestParamsEmptyCode        int = 10001
	RequestParamsPhoneErrorCode   int = 10002
	RequestParamsSendMsgErrorCode int = 10003
	ErrDateFormat                 int = 11001
	SessionEmptyCode              int = 20010
	SessionUidErrorCode           int = 20011
	PublicErrorCode               int = 30001
	DatabaseMysqlErrorCode        int = 50001
)

const (
	ConfigYamlNotExists         string = "config.yml 配置文件不存在"
	ConfigYamlParseFail         string = "config.yml 配置文件解析失败"
	DatabaseMongoConnectionFail string = "MongoDB 连接失败"
	DatabaseMySQLConnectionFail string = "MySQL 连接失败"
	DatabaseMySqlOptionFail     string = "数据库操作异常"
	DatabaseRedisConnectionFail string = "Redis 连接失败"
	DatabaseRedisOptionFail     string = "Redis 连接操作失败"
	RequestParamsEmpty          string = "请求参数错误"
	SendCodeError               string = "发送验证码失败"
	PhoneCheckError             string = "手机号校验失败"
	ParamBindError              string = "参数绑定异常"
	ParamValidateError          string = "参数校验异常"
	CodeGetError                string = "验证码获取失败"
	CodeNoEqualError            string = "验证码错误！请重新输入!"
	UfsConfigJsonIsFail         string = "ufs json文件丢失"
	LabelConfigJsonIsFail       string = "标签文件读取失败"
	LoadDataToCacheIsFail       string = "cache 数据加载失败"
)

type ErrRes struct {
	Code int
	Err  error
}

func NewErrInfo(code int, err error) *ErrRes {
	return &ErrRes{
		Code: code,
		Err:  err}
}
